<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="${section}"></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <!--引入bootstrap的css样式-->
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <!--自定义css样式-->
    <link rel="stylesheet" href="/css/community.css">
    <!--引入jQuery库 js样式才能生效-->
    <script src="/js/jquery-3.4.1.min.js"></script>
    <!--bootstrap js type="application/javascript"记得加上-->
    <script src="/js/bootstrap.min.js" type="application/javascript"></script>



</head>
<body>
<!--导航栏-->
<div th:insert="~{navigation.html :: nav}"></div>
<!--流式布局容器-->
<div class="container-fluid main profile">
    <div class="row">
        <!--左半部分-->
        <div class="col-lg-9 col-md-12 col-sm-12 col-sm-12"  >
            <h2><span th:text="${sectionName}"></span></h2>
            <hr>
            <!--我的问题列表-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-sm-12" th:if="${section=='questions'}">
                <!--问题列表-->
                <div class="media" th:each="questionDto : ${pagination.data}">
                    <!--用户头像-->
                    <div class="media-left">
                        <a href="#">
                            <img class="media-object img-rounded" th:src="@{${questionDto.user.avatarUrl}}">
                        </a>
                    </div>
                    <!--问题内容-->
                    <div class="media-body">
                        <h4 class="media-heading">
                            <a th:href="@{'/question/'+${questionDto.id}}" th:text="${questionDto.title}"></a>
                        </h4>
                        <span class="text-color-999">
                        <span th:text="${questionDto.commentCount==null?0:1}"></span> 个回复 •
                        <span th:text="${questionDto.viewCount==null?0:1}"></span> 个浏览 •
                        <span th:text="${#dates.format(questionDto.gmtCreate,'yyyy-MM-dd HH:mm')}"></span> •
                            <!--编辑   当用户登录并且问题是用户发布才能编辑-->
                    <a th:href="@{'/publish/'+${questionDto.id}}" class="edit"
                       th:if="${session.user!=null && session.user.id==questionDto.creator}">
                    <span class="glyphicon glyphicon-pencil" aria-hidden="true">编辑</span>
                    </a>
                    </span>
                    </div>
                </div>
                <!--分页栏-->
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        <!--第一页-->
                        <li th:if="${pagination.showFirstPage}">
                            <a th:href="@{'/profile/'+${section}(page=${1})}" aria-label="Previous">
                                <span aria-hidden="true">&lt;&lt;</span>
                            </a>
                        </li >
                        <!--上一页-->
                        <li th:if="${pagination.showPrevious}">
                            <a th:href="@{'/profile/'+${section}(page=${pagination.page}-1)}" aria-label="Previous">
                                <span aria-hidden="true">&lt;</span>
                            </a>
                        </li >
                        <!--页码-->
                        <li th:each="  page : ${pagination.pages}"th:class="${pagination.page==page}?'active':''">
                            <a th:href="@{'/profile/'+${section}(page=${page})}" th:text="${page}"></a>
                        </li>
                        <!--下一页-->
                        <li th:if="${pagination.showNext}">
                            <a th:href="@{'/profile/'+${section}(page=${pagination.page}+1)}" aria-label="Previous">
                                <span aria-hidden="true">&gt;</span>
                            </a>
                        </li >
                        <!--最后一页-->
                        <li th:if="${pagination.showEndPage}">
                            <a th:href="@{'/profile/'+${section}(page=${pagination.totalPage})}" aria-label="Previous">
                                <span aria-hidden="true">&gt;&gt;</span>
                            </a>
                        </li >
                    </ul>
                </nav>
            </div>
            <!--通知内容列表-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-sm-12" th:if="${section=='replies'}">
                <!--通知列表-->
                <div class="media" th:each="notification : ${pagination.data}">
                    <!--通知内容-->
                    <div class="media-body">
                        <p class="media-heading">
                            <span th:text="${notification.notifierName+' '+notification.typeName}"></span>
                            <a th:href="@{'/notification/'+ ${notification.id}}" th:text="${notification.outerTitle}"></a>
                            <span class="label label-danger" th:if="${notification.status==2}">未读</span>
                        </p>
                    </div>
                </div>
                <!--分页栏-->
                <div class="col-lg-12 col-md-12 col-sm-12 col-sm-12">

                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            <!--第一页-->
                            <li th:if="${pagination.showFirstPage}">
                                <a th:href="@{'/profile/'+${section}(page=${1})}" aria-label="Previous">
                                    <span aria-hidden="true">&lt;&lt;</span>
                                </a>
                            </li >
                            <!--上一页-->
                            <li th:if="${pagination.showPrevious}">
                                <a th:href="@{'/profile/'+${section}(page=${pagination.page}-1)}" aria-label="Previous">
                                    <span aria-hidden="true">&lt;</span>
                                </a>
                            </li >
                            <!--页码-->
                            <li th:each="  page : ${pagination.pages}"th:class="${pagination.page==page}?'active':''">
                                <a th:href="@{'/profile/'+${section}(page=${page})}" th:text="${page}"></a>
                            </li>
                            <!--下一页-->
                            <li th:if="${pagination.showNext}">
                                <a th:href="@{'/profile/'+${section}(page=${pagination.page}+1)}" aria-label="Previous">
                                    <span aria-hidden="true">&gt;</span>
                                </a>
                            </li >
                            <!--最后一页-->
                            <li th:if="${pagination.showEndPage}">
                                <a th:href="@{'/profile/'+${section}(page=${pagination.totalPage})}" aria-label="Previous">
                                    <span aria-hidden="true">&gt;&gt;</span>
                                </a>
                            </li >
                        </ul>
                    </nav>
                </div>
            </div>
        </div>
        <!--右半部分-->
        <div class="col-lg-3 col-md-12 col-sm-12 col-sm-12"  >
        <div class="list-group section" >
            <a href="/profile/questions" th:class="${section=='questions'}?'active list-group-item':'list-group-item'">我的问题</a>
            <a href="/profile/replies" th:class="${section=='replies'}?'active list-group-item':'list-group-item'">
                最新回复
                <span class="badge" th:text="${session.unreadCount}"></span>
            </a>
        </div>
        </div>
    </div>

</div>
<!--页尾-->
<div th:insert="~{foot.html :: foot}"></div>
</body>
</html>